﻿using System.Xml;

namespace Jayden.Dll.Sc2.Descriptions.Terran
{
	public class AddOnAttachedDescription : EntityDescription
	{
		private string m_BuildingId;
		private EntityDescription m_Building;

		public AddOnAttachedDescription(RaceDescription race, XmlNode entityNode)
			: base(race, entityNode)
		{
			m_BuildingId = entityNode.Attributes["building"].Value;
		}

		public override string IconId { get { return Inherits.IconId; } }
		public override string Name { get { return string.Format("{0} attached to {1}", Inherits.Name, Building.Name); } }

		public EntityDescription Building
		{
			get
			{
				if (m_Building == null && m_BuildingId != null)
					m_Building = Race[m_BuildingId];
				return m_Building;
			}
		}

	}
}
